import os
from celery import Celery
# 实际项目中单独配置 Celery,这里很重要

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'my_celery.settings')

app = Celery('my_celery',broker='redis://127.0.0.1:6379/10')

app.config_from_object('my_celery.settings',namespace='CELERY')

app.autodiscover_tasks(['my_celery.tasks'])